home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 2000
/
MacHack 2000.toast
/
pc
/
The Hacks
/
Softshoe
/
Lisa's Mac Parts
/
Files
/
Locations
/
Directory.h
< prev
next >
Wrap
Text File
|
2000-06-23
|
1KB
|
57 lines
// Directory.h
#ifndef Directory_h
#define Directory_h
#ifndef Volume_h
#include "Volume.h"
#endif
#ifndef DirectoryID_h
#include "DirectoryID.h"
#endif
#ifndef ConstPString_h
#include "ConstPString.h"
#endif
#include <Folders.h>
class FileLocation;
class Directory
{
private:
::Volume volume;
DirectoryID id;
static Directory FindSpecialFolder( OSType folder, ::Volume volume, bool canCreate );
static ::Volume System() { return ::Volume( kOnSystemDisk ); }
public:
Directory( ::Volume theVolume, DirectoryID theID = DirectoryID::Root() )
: volume( theVolume ),
id( theID )
{}
::Volume Volume() const { return volume; }
DirectoryID ID() const { return id; }
bool IsRoot() const { return id == DirectoryID::Root(); }
void Up();
void Down( ConstPString );
Directory Parent() const;
bool operator==( Directory d ) const { return volume == d.volume && id == d.id; }
bool operator!=( Directory d ) const { return volume != d.volume || id != d.id; }
static Directory Find( OSType folder, ::Volume volume = System() )
{ return FindSpecialFolder( folder, volume, false ); }
static Directory FindOrMake( OSType folder, ::Volume volume = System() )
{ return FindSpecialFolder( folder, volume, true ); }
};
#endif